﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Principal;
using System.Web.Mvc;

namespace Lilium.Web.Mvc.Security
{
    public class AuthorizationContext : ActionContext
    {
        public AuthorizationContext(IPrincipal user, ActionContext actionContext)
            : base(actionContext)
        {
            if (user == null) throw new ArgumentNullException("user");

            m_User = user;
        }

        #region public ICollection<string> AuthorizationMessages

        private readonly ICollection<string> m_AuthorizationMessages = new List<string>();

        public ICollection<string> AuthorizationMessages
        {
            get
            {
                return m_AuthorizationMessages;
            }
        }

        #endregion

        #region public TempDataDictionary RedirectData

        private readonly TempDataDictionary m_RedirectData = new TempDataDictionary();

        public TempDataDictionary RedirectData
        {
            get
            {
                return m_RedirectData;
            }
        }

        #endregion

        #region public IPrincipal User

        private readonly IPrincipal m_User;

        public IPrincipal User
        {
            get
            {
                return m_User;
            }
        }

        #endregion
    }
}